package com.example.barcodeapp.ui.home.activity;

import android.os.Bundle;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.barcodeapp.R;
import com.example.barcodeapp.adapter.AdapterMianfeiLeiBiao;
import com.example.barcodeapp.adapter.gatheradapter.AdapterMianFei;
import com.example.barcodeapp.base.BaseActivity;
import com.example.barcodeapp.common.Constants;
import com.example.barcodeapp.interfaces.own.IOwn;
import com.example.barcodeapp.persenter.OnePresenterMianFeiKeCheng;
import com.example.barcodeapp.ui.home.bean.MianFeiKeChengBean;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MianFeiActivity extends BaseActivity<IOwn.Persentermianfeikecheng> implements IOwn.Viewmianfeikecheng {
    @BindView(R.id.mianfeikehceng)
    RecyclerView mianfeikehceng;

    @Override
    protected int getLayout() {
        return R.layout.mianfei_activity;
    }

    @Override
    protected void initView() {
        setToolBar(true, false, true, false, false);
        setTitle("免费课程", R.color.black, R.color.white);
    }

    @Override
    protected OnePresenterMianFeiKeCheng initPersenter() {
        return new OnePresenterMianFeiKeCheng();
    }


    @Override
    protected void initData() {
        persenter.getmianfeikehceng(Constants.mianfeikecheng);
    }

    @Override
    public void getjiaoxiangqing(MianFeiKeChengBean xiLieKeBean) {
        mianfeikehceng.setLayoutManager(new LinearLayoutManager(this));
        AdapterMianfeiLeiBiao adapterMianFei = new AdapterMianfeiLeiBiao(this, xiLieKeBean.getData());
        mianfeikehceng.setAdapter(adapterMianFei);
        adapterMianFei.notifyDataSetChanged();
    }
}
